package com.bai.ks2022.controller;

import com.bai.ks2022.entity.Test;
import com.bai.ks2022.mapper.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/admin")
public class UserController {
    @Autowired
    private UserDao userDao;

    @GetMapping("/select")
    public String QueryUserById(Model model, int id) {
        Test test = userDao.QueryUserById(id);
        model.addAttribute("test", test);
        return "user";
    }

    @GetMapping("/abnormal")
    public String QueryAbnormal(Model model) {
        List<Test> testList = userDao.QueryAbnormal();
        model.addAttribute("testList", testList);
        return "abnormal";
    }
}

